//
//  NSObject+Singleton.h
//  HeartWorld
//
//  Created by zhangji on 2016/10/18.
//  Copyright © 2016年 谭明权. All rights reserved.
//

#import <Foundation/Foundation.h>

#pragma mark - 单例

#undef	singleton
#define singleton( __class ) \
property (nonatomic, readonly) __class * sharedInstance; \
- (__class *)sharedInstance; \
+ (__class *)sharedInstance;

#undef	def_singleton
#define def_singleton( __class ) \
dynamic sharedInstance; \
- (__class *)sharedInstance \
{ \
return [__class sharedInstance]; \
} \
+ (__class *)sharedInstance \
{ \
static dispatch_once_t once; \
static __strong id __singleton__ = nil; \
dispatch_once( &once, ^{ __singleton__ = [[__class alloc] init]; } ); \
return __singleton__; \
}



@interface NSObject (Singleton)

- (NSArray*)cl_TranModelArray:(NSArray*)array modelName:(NSString*)modelName;

- (id)cl_TranModelDic:(id)model modelName:(NSString*)modelName;

+ (id)sharedInstance;
- (id)sharedInstance;

@end
